Lab 2 Task:¶

Matplotlib¶

This graph shows a simple scatter plot graph with random colors and 50 randomly positioned points

In [3]:
import matplotlib.pyplot as plt
import numpy as np

# Fixing random state for reproducibility
np.random.seed(19680801)


N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = (30 * np.random.rand(N))**2  # 0 to 15 point radii

plt.scatter(x, y, s=area, c=colors, alpha=0.5)
plt.show()

Plotly¶

This graph loads the Iris flower data set and shows the sepal_width and sepal_length on the x and y axis respectively

In [5]:
import plotly
plotly.offline.init_notebook_mode()
In [6]:
import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", color='petal_length')
fig.show()

Seaborn¶

This graph shows the signal change over time for different regions and events

In [7]:
import seaborn as sns
sns.set_theme(style="darkgrid")

# Load an example dataset with long-form data
fmri = sns.load_dataset("fmri")

# Plot the responses for different events and regions
sns.lineplot(x="timepoint", y="signal",
             hue="region", style="event",
             data=fmri)
Out[7]:
<Axes: xlabel='timepoint', ylabel='signal'>

Additional Markdown:¶

Please click this link to my GitHub labs repo

Tables:¶

Student Name Student ID
Hamna Ashraf 8826836

Image:¶

Screenshot of animted github logo